<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // Person.prototype ===>原型(是对象)
        // Person.prototype={} ====>是祖先

        //Person.prototype.name = "wswj";
        Person.prototype = {
            name: "wswj",
            sex: "男",
            //constructor: Car
        }

        function Person() {}
        var car = {
            carname: "car"
        }
        var p = new Person();
        console.log(p);
        //改变p的原型指向car而非原来的Person
        p.__proto__ = car;
        console.log(p.carname);




        // constructor为构造函数,__proto__中放的是原型本身
    </script>
</body>

</html>